-
Notifications
You must be signed in to change notification settings - Fork 49
Conversation
Gevulot devnet is permissioned due to its nature. For this need, implement basic transaction authorization based on authors' public keys.
@@ -12,6 +12,7 @@ DROP TYPE IF EXISTS transaction_kind; | |||
CREATE TYPE transaction_kind AS ENUM ('empty','transfer', 'stake', 'unstake', 'deploy', 'run', 'proof', 'proofkey', 'verification', 'cancel'); | |||
|
|||
CREATE TABLE transaction ( | |||
author VARCHAR(130) NOT NULL, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a bit drive-by change and I wouldn't normally combine these, but gotta move fast 🙈
@@ -140,22 +153,20 @@ impl workflow::TransactionStore for storage::Database { | |||
} | |||
} | |||
|
|||
struct AuthenticatingTxHandler { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Authorizing in mempool
is better approach than in P2P handler. mempool
captures both, JSON-RPC & P2P.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It opens a lot of discussion about software architecture, auth needs, ... but as you say we've to move fast. So we'll see later.
let bs = std::fs::read(key_file)?; | ||
let key = SecretKey::parse(bs.as_slice().try_into()?)?; | ||
let public_key = PublicKey::from_secret_key(&key); | ||
println!("{}", hex::encode(public_key.serialize())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use log::trace! instead of println!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, isn't println!
totally fine in this case as it's purely meant to be "write to stdout" for end user, no matter what the logging configuration is?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah ok, I didn't really investigate the reason, I thought it was one forgets.
True, but to make it even funnier, once we get into testnet phase, the authorization goes away 😝 |
Gevulot devnet is permissioned due to its nature. For this need,
implement basic transaction authorization based on authors' public keys.